﻿/*
* share
*/
function hxshare_send(type) {
    //var hxs_url = news_host + '/share.php?type=' + type + '&from_url=' + url + '&title=' + title + '';
    //window.location.href = hxs_url;
    
    if (type == "hx_wb") {
        window.location.href = "http://m.hexun.com/hx_share.php?appkey=6EE7C42ECE1ADA972742BEF492C6E666&url=" + url + "&title=" + title + "";
    }
    if (type == "sina_wb") {
        window.location.href = "http://service.weibo.com/share/share.php?appkey=30521067&url=" + url + "&title=" + title + "&sourceUrl=&content=utf-8&pic=&ralateUid=";
        
    }
    if (type == "qq_wb") {
        window.location.href = "http://share.v.t.qq.com/index.php?c=share&a=index&url=" + url + "&appkey=801285872&title=" + title + "&line1=";
    }
    if (type == "qq_zone") {
        window.location.href = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+url+"&showcount=0&desc=&summary=&title="+title+"&pics=&style=203&width=98&height=22";
    }
}

/*
* set
*/
function setCookie(c_name, value, expiredays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()) + ";path=/";
}

function getCookie(c_name, re_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return re_name;
}

function a_news() {
    var style = $('.news_nav').attr('style');
    if (style == 'display: none;') {
        $('.news_nav').attr('style', 'display: block;');
    } else if (style == 'display: block;') {
        $('.news_nav').attr('style', 'display: none;');
    }
}

function init_content() {
    var rizi = getCookie('rizi', 'from_day');
    var ziti = getCookie('ziti', 'c_ft28');
    $("#content").removeClass();
    $("#content").addClass(rizi);
    $("#content #newsArticle").removeClass();
    $("#content #newsArticle").addClass(ziti);
}

function init_rn_color() {
    var rizi = getCookie('rizi', 'from_day');
    if (rizi == 'from_dark') {
        // $(".rn_list").css("color", "#cecdcd");
    } else if (rizi == 'from_day') {
        $(".rn_list").css("color", "");
    }
}

function set_size(f) {
    setCookie('ziti', f, 3600);
    $("#content #newsArticle").removeClass();
    $("#content #newsArticle").addClass(f);
}
function fn_time() {
    var fn_time = $('#content').attr('class');
    if (fn_time == 'from_day') {
        setCookie('rizi', 'from_dark', 3600);
        $("#content").removeClass();
        $("#content").addClass('from_dark');

        //$(".rn_list").css("color", "#cecdcd");
        //alert($("#news_rel_list li").siblings('a'));
    } else if (fn_time == 'from_dark') {
        setCookie('rizi', 'from_day', 3600);
        $("#content").removeClass();
        $("#content").addClass('from_day');
        $(".rn_list").css("color", "");
    }
}

function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null)
        return unescape(r[2]);
    return null;
}
$(function () {
    $(".banner b").click(function () {
        $(".banner").css("display", "none");
    })
})

/*
* 璇勮
*/
$(document).ready(function () {
    init_content();
    init_rn_color();
});